-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(cleanup): Remove the AppConfig and KeyManager singletons #625
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #625 +/- ##
========================================
+ Coverage 8.99% 9.04% +0.04%
========================================
Files 99 99
Lines 7761 7809 +48
========================================
+ Hits 698 706 +8
- Misses 6989 7030 +41
+ Partials 74 73 -1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good to me! finally! :)
Co-authored-by: Ettore Di Giacinto <[email protected]> Signed-off-by: Mario Camou <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
Description
Singletons are a bad practice which makes it difficult to write proper tests for the code. This PR (almost) removes the two singletons we have:
AppConfig
singleton, used throughout the codebase to get access to the node configurationKeyManager
singleton, used to get access to private and public keysWe remove both singletons in one go since it is very complicated to remove just
AppConfig
without removingKeyManager
. They are replaced either with functional options, by adding some fields to other objects (i.e.OracleNode
) or, in cases where there are just one or config parameter needed in one place in the code, passing them directly as parameters.This PR removes
config.GetInstance()
from everywhere except the Sentiment-related files, since those will be removed as part of a separate PR (see #626).Notes to reviewers
If the full PR is a bit much, the commit history should be more manageable. If preferred, I could split this into multiple PRs.
Signed commits